
def run(params:list[str]):
    import json
    from ApiTools import apiTools,apiBase
    from ApiModels import apiModels
    collects = apiBase.argv_array(params,1,'docname;',';')
    sys_prompt = apiBase.argv(params,2,"system")
    #文件夹还是字符串
    q = apiBase.argv(params,3,"exec dbo. usp_CN_GetUserSubscribeCheckpoints @ProjectID = 'XRL', @strUserName = 'N072730' ")
    tool_id = apiBase.argv_int(params,4)
    vct_ids = apiBase.argv_array(params,5)
    try:
        vectdb = apiTools.load_vec()
        if vct_ids:
            vcts=apiModels.get_vect_ids(vct_ids)
        else:
            vcts=apiModels.get_vect_names(collects)
        tool=apiModels.get_tool(id=tool_id)
        task=vectdb.fixQA(vcts,sys_prompt,q,tool)
        ret=json.dumps(task, ensure_ascii=False)
        return ret
    except Exception as e:
        return f"function error:{e}"
